/**
* Copyright (c) By zengqh.
*
* This program is just for fun or demo, in the hope that it  
* will be useful, you can redistribute it and/or modify freely.
*
* Time: 2013/03/05
* File: RenderTarget.h
**/

#pragma once

#include <render_system/BaseRenderSystem/RenderTarget2D.h>

namespace HY
{
class OGLRenderTarget2D : public RenderTarget2D
{
	friend class OGLRenderSystem;
public:
	virtual ~OGLRenderTarget2D();

	virtual void release();

	void setColorTexture(uint8 idx, Texture2D* tex);

	void setDepthTexture(Texture2D* tex);

	uint32 getHandle() const 
	{
		return handle_;
	}

	virtual void bind();
	virtual void unbind();

	virtual const IntVector2& getSize() const
	{
		return size_;
	}

protected:
	OGLRenderTarget2D();
	bool createFrameBuffer();

protected:
	bool								has_depth_;	
	std::vector<Texture2D*>				color_texture_list_;
	Texture2D*							depth_texture_;
	uint32								handle_;
	IntVector2							size_;
};

}